<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>JaWeMa - WebMail</title>
    </h:head>
    <h:body>
        <fieldset>
            <h:form rendered="#{userSession.loggedIn}">
                <h:dataTable value="#{userSession.messages}" var="message">
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Number"/>
                        </f:facet>
                        <h:outputText value="#{message.messageNumber}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="From"/>
                        </f:facet>
                        <h:outputText value="#{message.from[0]}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Subject"/>
                        </f:facet>
                        <h:outputText value="#{message.subject}"/>
                    </h:column>
                    <h:column>
                        <h:commandButton action="#{userSession.selectMessage(message)}" value="message"/>
                    </h:column>
                </h:dataTable>
                <h:commandButton value="Prev" action="#{userSession.prev}" rendered="#{userSession.prev}"/>
                <h:inputText value="#{userSession.interval}">
                    <f:validateLongRange minimum="3"/>
                </h:inputText>
                <h:commandButton value="Next" action="#{userSession.next}"/>
                <h:commandButton value="Logout!" action="#{userSession.logout}"/>
            </h:form>
        </fieldset>
        <h:form>
            <fieldset>
                <h:outputText value="#{userSession.message}"/>
            </fieldset>
        </h:form>
    </h:body>
</html>

